package com.demo.personalaccountingbackend.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 类描述信息
 *
 * @author zgx
 * @version 1.0
 * @date 2025/10/15 11:37
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("category")
public class Category {

    @Schema(description = "主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "分类名称")
    @TableField(value = "name")
    private String name;

    @Schema(description = "分类类型：0=支出，1=收入")
    @TableField(value = "type")
    private Integer type;

    @Schema(description = "父级分类ID，0表示顶级分类")
    @TableField(value = "parent_id")
    private Long parentId;

    @Schema(description = "图标标识")
    @TableField(value = "icon")
    private String icon;

    @Schema(description = "颜色代码")
    @TableField(value = "color")
    private String color;

    @Schema(description = "排序权重")
    @TableField(value = "sort")
    private Integer sort;

    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "子分类列表")
    @TableField(exist = false)
    private List<Category> children;

    @Schema(description = "状态位，0正常，1弃用")
    @TableField(value = "status")
    private Integer status;
}